<template>
  <div class="company">
    <el-container>
      <el-header >
        <div :class="pathMiddle">
          <div class="logo  fl">
            <img src="../assets/img/xh_logo.png" alt="">
          </div>
          <div class="fullName fl">
            <span>{{$store.state.user.full_name}}</span>
          </div>
          <!--  -->
          <el-popover
            placement="bottom"
            width="144"
            popper-class='option-menu'
            :visible-arrow='false'
            trigger="click">
            <div class="option fr" @click="option" slot="reference"></div>
            <ul>
              <!-- <li>
                <router-link to='/company/home/recommend'>我的推荐</router-link>
              </li>
               -->

              <!-- <li>
                <router-link to='/company/home/editInformation'>修改资料</router-link>
              </li> -->
              <li>
                <router-link to='/company/home/editPassword'>修改密码</router-link>
                <div class="arrow"></div>
              </li>
              <!-- <li>
                <router-link to='/company/home/opinion'>意见反馈</router-link>
              </li> -->
              <li>
                <!-- <router-link to='' ></router-link> -->
                <span @click='quit'>退出</span>
              </li>
            </ul>

          </el-popover>
        </div>
       
      </el-header>
      <el-main class=''>
        <nuxt-child />
      </el-main>
      <el-footer>
        <p class="record tc">{{record}}</p>
        <div class="footer tc">
          <a href="" class="footer_logo"></a>
          <span class="footer_text">武汉溟宇科惠知识产权服务有限公司</span>
        </div>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import {RECORD} from '../util/config'
import { getMyInfo } from "~/api/user"
export default {
  data () {
    return {
      agentLogo: '',
      record: RECORD
    }
  },
  computed: {
    pathMiddle () {
      let path = this.$route.path
      if (path.indexOf('/company/statistics/inventor') != '-1' 
          || path.indexOf('/company/statistics/order') != '-1'
          || path.indexOf('/company/order/unsubmitted') != '-1'
          || path.indexOf('/company/order/submitted') != '-1'
          || path.indexOf('/company/order') != '-1'
          ) {
        return 'newsMiddle clearfloat head'
      } else if (path.indexOf('/agent/rank') != '-1') {
        return 'rankMiddle clearfloat head'
      } 
      return 'middle clearfloat head'
    }
  },
  created () {
  },
  methods: {

    option () {

    },
    quit () {
      this.$confirm("是否退出登录?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        center: true,
        type: "warning"
      })
      .then(() => {
        // let url = this.$store.state.user.role_id == 2 ? '/login?type=1' : '/admin/login'
        // if (this.$route.name.indexOf('agentImprove') > -1) {
        //   url = '/order/login'
        // }
        let url = '/companyLogin'
        this.$store.commit("delToken")
        this.$cookies.remove("token")
        this.$store.commit("delUser")
        this.$cookies.remove("user")
        // if(process.client) {
        //   window.localStorage.setItem('auto_login', JSON.stringify(false))
        // }
        this.$router.push({
          path: url
        });
      })
      .catch(() => {
      })
    }
  }
}
</script>

<style lang="less" scoped>
  .company {
    width: 100%;
    height: 100%;
    .middle {
      width: 1110px;
      margin: 0 auto;
    }
    .newsMiddle {
      width: 90%;
      margin: 0 auto;
    }
    .rankMiddle {
      width: 853px;
      margin: 0 auto;
    }
    /deep/.el-container {
      width: 100%;
      height: 100%;
      background:rgba(244,247,255,1);
      .el-header {
        padding: 0;
        width:100%;
        height:90px !important;
        background:rgba(255,255,255,1);
        .head {
          height: 100%;

        }
        .logo {
          height: 50px;
          width: 50px;
          margin-top: 20px;
          margin-right: 10px;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .fullName {
          font-size:24px;
          color:rgba(27,27,27,1);
          line-height: 90px;
        }
        .option {
          width: 27px;
          height: 27px;
          margin-top: 30px;
          background:url('../assets/img/图标.png') no-repeat;
          background-position:-173px -32px;
          cursor:pointer; 
        }
        
      }
      /deep/.el-main {
        padding:20px 0 0 0;
        
      }
      /deep/.el-footer {
        height: 114px !important;
        padding-top: 20px;
        font-size: 15px;
        color:rgba(51,51,51,1);
        .record {
          
        }
        .footer {
          margin-top: 20px;
          .footer_logo {
            display: inline-block;
            width: 48px;
            height: 22px;
            background:url('../assets/img/图标.png') no-repeat;
            background-position:-282px -316px;
          }
          .footer_text {
            margin-left: 19px;
            display: inline-block;
            vertical-align: top;
          }
        }
        
      }
    }

  }
 
</style>